package jpa.Model;

import javax.persistence.*;

/**
 * Created by IntelliJ IDEA.
 * User: Pavlo
 * Date: 30.01.12
 * Time: 18:03
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "VoteResult")
public class VoteResult extends ID{

    private Protocol protocol;

    private Candidate candidate;

    private int votes;

    @ManyToOne(optional = false)
    @JoinColumn(name = "protocol", referencedColumnName = "ID")
    public Protocol getProtocol() {
        return protocol;
    }

    public void setProtocol(Protocol protocol) {
        this.protocol = protocol;
    }

    @ManyToOne(optional = false)
    @JoinColumn(name = "candidate", referencedColumnName = "ID")
    public Candidate getCandidate() {
        return candidate;
    }

    public void setCandidate(Candidate candidate) {
        this.candidate = candidate;
    }

    @Column(name = "votes", nullable = false, unique = false)
    public int getVotes() {
        return votes;
    }

    public void setVotes(int votes) {
        this.votes = votes;
    }
}
